﻿namespace PassiveView.Tests
{
    using System.Collections.Generic;
    using NUnit.Framework;
    using Rhino.Mocks;

    [TestFixture]
    public class The_account_registration_form
    {
        private RegistrationController a_controller;
        private IRegistrationView a_view;

        [SetUp]
        public void given_a_context_of()
        {
            var service = MockRepository.GenerateStub<IRegistrationService>();

            a_view = MockRepository.GenerateStub<IRegistrationView>();

            a_controller = new RegistrationController(a_view, service);
        }

        [Test]
        public void is_not_enabled_when_the_email_address_is_blank()
        {
            a_view.Stub(x => x.Email).Return(string.Empty);
            a_view.Stub(x => x.Password).Return("pw");
            a_view.Stub(x => x.Confirm).Return("pw");
            a_view.Stub(x => x.ValidationErrors).Return(new List<string>());

            a_controller.ValidateForm();

            a_view.AssertWasCalled(x => x.Disable());
        }
    }
}